package com.collect.cameroon.zhiScene.zhiAuditer.zhiFollow;

import android.annotation.SuppressLint;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;

import com.collect.cameroon.zhiScene.zhiAuditer.zhiFollow.zhiCollect.ZHIAuditerCollectFragment;
import com.collect.cameroon.zhiScene.zhiAuditer.zhiFollow.zhiD0.ZHIAuditerD0Fragment;
import com.collect.cameroon.zhiScene.zhiAuditer.zhiFollow.zhiD1.ZHIAuditerD1Fragment;
import com.collect.cameroon.zhiScene.zhiAuditer.zhiFollow.zhiReview.ZHIAuditerReviewFragment;

public class ZHIAuditerFollowPageAdapter extends FragmentPagerAdapter {

    private final ZHIAuditerD0Fragment mZHIAuditerD0Fragment = new ZHIAuditerD0Fragment();
    private final ZHIAuditerCollectFragment mZHIAuditerCollectFragment = new ZHIAuditerCollectFragment();
    private final ZHIAuditerReviewFragment mZHIAuditerReviewFragment = new ZHIAuditerReviewFragment();

    private FragmentManager mFragmentManager;

    public ZHIAuditerFollowPageAdapter(FragmentManager fm) {
        super(fm, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT);
        mFragmentManager = fm;
    }

    @SuppressLint("CommitTransaction")
    @NonNull
    @Override
    public Fragment getItem(int position) {
//        Log.d("ZHIAuditerFollowPageAdapter", "getItem: "+position);
//       FragmentTransaction transaction = mFragmentManager.beginTransaction();
        switch (position) {
            case 1:
                return  new ZHIAuditerD0Fragment();
            case 2:
                return  new ZHIAuditerD1Fragment();
            case 3:
                return  new ZHIAuditerCollectFragment();
            default:
                return  new ZHIAuditerReviewFragment();
        }
    }

    @Override
    public int getCount() {
        return 4;
    }

    @Nullable
    @Override
    public CharSequence getPageTitle(int position) {
        switch (position) {
            case 1:
                return "D-0";
            case 2:
                return "D-1";
            case 3:
                return "Collect";
            default:
                return "Review";
        }
    }
}
